<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>我的收货地址</title>
    <link rel="stylesheet" href="css/reset.css" />
    <link rel="stylesheet" href="css/all.css" />
    <script src="js/jquery-1.7.1.min.js"></script>
    <script src="js/self.js"></script>
</head>
<body  ontouchstart="">
<div class="detailTop pf w100 of">
     <div class="w100 of tc c3 f18">
         <span class="pa" style="left: 10px;font-size: 30px;color: #444444;" onclick="javascript:history.back();">&laquo;</span>
         我的收货地址
     </div>
</div>

<div class="container jz h100" style="margin-top: 41px;">
    <script src="js/jquery.cityselect.js"></script>

    <section class="w88 jz of" style="margin-top: 35px;">
        <div id="city_3" class="w100 of clearfix">
            <div class="fl f14" style="width: 50%;line-height: 38px;">
                省份：<select class="prov" id="prov" required="required" name=""></select>
            </div>
            <div class="fr f14" style="width: 50%;line-height: 38px;">
                城市：<select class="city" id="city" disabled="disabled" required="required" name=""></select>
            </div>
        </div>
    </section>
    <script>
        $(function () {
            $("#city_3").citySelect({prov:"省份", city:"城市",required: false});
        })
    </script>
    <section class="w88 jz of" style="margin-top: 15px;">
        <div class="addressBlock w100">
            <textarea required="required" placeholder="详细地址" id="detailAddress"></textarea>
        </div>
    </section>
    <section class="w88 jz of" style="margin-top: 15px;">
        <div class="addressBlock w100">
            <input type="text" name="username" value="" placeholder="联系人" required="required" id="username" class="addressInput"/>
        </div>
    </section>
    <section class="w88 jz of" style="margin-top: 15px;">
        <div class="addressBlock w100">
            <input type="tel" name="usertel" value="" placeholder="联系电话" required="required" id="usertel" class="addressInput"/>
        </div>
    </section>
    <div class="detailBottm pf w100 of">
        <button type="button" class="db w100 f18 cf f18 tc" id="addressSub">申请确定发货</button>
    </div>

</div><!--container-->
<div class="theme-popover-mask">
    <div class="w100 h100 of">
        <img src="images/loading.gif" class="jz hauto db" style="margin-top: 66%;width: 32px"/>
    </div>
</div>
<script>
    function proEstimate() {
        var provVal =$.trim($(".prov").find("option:selected").val());
        var cityVal =$.trim($(".city").find("option:selected").val());
        if(!(provVal == "请选择")&&!(cityVal == "请选择")){
            var info={"prov":provVal,"city":cityVal};
            return info;
        }else{

            return false;
        }
    }
    $(function () {
        $('#addressSub').click(function () {
            proEstimate();
            var info=proEstimate();
            if(info== false){
                alert("你尚未选择'省份'或者'城市'")
                return false;
            }
            var prov=info["prov"];
            var city=info["city"];

            var username =$.trim($('#username').val());
            var usertel = $.trim($('#usertel').val());
            var detailAddress = $.trim($('#detailAddress').val());


            if(usertel== ""){
                alert("你还未填写联系电话");
                return false;
            }
            if(username== ""){
                alert("你还未填写联系人");
                return false;
            }
            if(detailAddress== ""){
                alert("你还未填写详细地址");
                return false;
            }
            $.ajax({
                url: "",
                data: {prov: prov, city: city, username: username, usertel: usertel,detailAddress:detailAddress},
                type: 'post',
                dataType: 'json',
                beforeSend: function () {
                    $('.theme-popover-mask').show();
                },
                success: function (data) {
                    console.log(data);
                    if (data.code == 200) {
//                        alert("您的申请已提交,等待审核");
//                        alert(data.msg);
//                        window.location.reload();
//                        location.href = "withdraw.html";
                    }else{
//                        alert(data.msg);
                        //window.history.back(-1);
                    }
                },
                error: function (data) {
                    alert(data.msg);
                    return false;
                },
                complete: function () {
                    alert("申请成功，前去查看");
                    $('.theme-popover-mask').hide();
                }
            });
        })

    })

</script>
</body>
</html>
